/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author corneliugosa
 */
@Entity
@Table(name = "timetable")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Timetable.findAll", query = "SELECT t FROM Timetable t")})
public class Timetable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @JoinColumn(name = "id_classroom_reservation", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ClassroomReservation idClassroomReservation;
    @JoinColumn(name = "id_class", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Class idClass;
    @JoinColumn(name = "id_subject_matter", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private SubjectMatter idSubjectMatter;
    @JoinColumn(name = "id_proffessor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Person idProffessor;

    public Timetable() {
    }

    public Timetable(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public ClassroomReservation getIdClassroomReservation() {
        return idClassroomReservation;
    }

    public void setIdClassroomReservation(ClassroomReservation idClassroomReservation) {
        this.idClassroomReservation = idClassroomReservation;
    }

    public Class getIdClass() {
        return idClass;
    }

    public void setIdClass(Class idClass) {
        this.idClass = idClass;
    }

    public SubjectMatter getIdSubjectMatter() {
        return idSubjectMatter;
    }

    public void setIdSubjectMatter(SubjectMatter idSubjectMatter) {
        this.idSubjectMatter = idSubjectMatter;
    }

    public Person getIdProffessor() {
        return idProffessor;
    }

    public void setIdProffessor(Person idProffessor) {
        this.idProffessor = idProffessor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Timetable)) {
            return false;
        }
        Timetable other = (Timetable) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Timetable[ id=" + id + " ]";
    }
    
}
